/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * FrmInventaris.java
 *
 * Created on 30 Okt 12, 13:00:35
 */
package sistemperpustakaan.view.buku;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JRadioButton;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.event.InternalFrameEvent;
import javax.swing.event.InternalFrameListener;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.table.DefaultTableCellRenderer;
import sistemperpustakaan.controller.InventarisController;
import sistemperpustakaan.model.InventarisModel;
import sistemperpustakaan.tablemodel.InventarisTableModel;
import sistemperpustakaan.utility.ReportUtility;
import sistemperpustakaan.view.FrmMain;

/**
 *
 * @author EKo
 */
public class FrmInventaris extends javax.swing.JInternalFrame implements InternalFrameListener, ListSelectionListener {

    int opt = -1;
    String inventarisId = "KI000000";
    FrmMain frameMain;
    DialogInventarisDetail inventarisDetail;
    InventarisModel inventarisModel;
    InventarisTableModel tableModel;
    InventarisController controller;

    /** Creates new form FrmInventaris */
    public FrmInventaris(FrmMain frameMain) {
        initComponents();
        this.frameMain = frameMain;
        inventarisModel = new InventarisModel();
        controller = new InventarisController(this, inventarisModel);
        tblInventaris.setModel(new InventarisTableModel());
        tblInventaris.getSelectionModel().addListSelectionListener(this);
        addInternalFrameListener(this);
        setTableView();
        setAction();
        setCombo();
        setRadio();
        //controller.findListInventaris();
            

    }

    public static final int PILIH_SEMUA = -1;
    public static final int PILIH_TERSEDIA = 0;
    public static final int PILIH_TERPINJAM = 1;
    public static final int PILIH_HILANG = 2;

    protected final void setRadio() {
        radioSemua.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                opt = PILIH_SEMUA;
            }
        });
        radioTersedia.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                opt = PILIH_TERSEDIA;
            }
        });
        radioTerpinjam.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                opt = PILIH_TERPINJAM;
            }
        });
        radioHilang.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                opt = PILIH_HILANG;
            }
        });
        radioSemua.setSelected(true);
    }
    DefaultTableCellRenderer centerCellRenderer = new DefaultTableCellRenderer();
    DefaultTableCellRenderer rightCellRenderer = new DefaultTableCellRenderer();

    public final void setTableView() {
        int[] width = {80, 80, 100, 120, 600, 200, 100, 60};
        for (int i = 0; i < 8; i++) {
            tblInventaris.getColumnModel().getColumn(i).setPreferredWidth(width[i]);
        }
        centerCellRenderer.setHorizontalAlignment(JLabel.CENTER);
        rightCellRenderer.setHorizontalAlignment(JLabel.RIGHT);
        //tblInventaris.getColumnModel().getColumn(7).setCellRenderer(centerCellRenderer);
    }

    private void setCombo() {
        comboPenerbit.setModel(new DefaultComboBoxModel(inventarisModel.getVectorPenerbit()));
        comboPenerbit.setSelectedIndex(0);
    }

    public InventarisTableModel getTableModel() {
        return tableModel;
    }

    public void setTableModel(InventarisTableModel tableModel) {
        this.tableModel = tableModel;
    }

    public int getOpt() {
        return opt;
    }

    public void setOpt(int opt) {
        this.opt = opt;
    }

    public String getInventarisId() {
        return inventarisId;
    }

    public void setInventarisId(String inventarisId) {
        this.inventarisId = inventarisId;
    }

    public InventarisModel getInventarisModel() {
        return inventarisModel;
    }

    public void setInventarisModel(InventarisModel inventarisModel) {
        this.inventarisModel = inventarisModel;
    }

    public JTable getTblInventaris() {
        return tblInventaris;
    }

    public void setTblInventaris(JTable tblInventaris) {
        this.tblInventaris = tblInventaris;
    }

    public JTextField getTxtBukuId() {
        return txtBukuId;
    }

    public void setTxtBukuId(JTextField txtBukuId) {
        this.txtBukuId = txtBukuId;
    }

    public JTextField getTxtInventarisId() {
        return txtInventarisId;
    }

    public void setTxtInventarisId(JTextField txtInventarisId) {
        this.txtInventarisId = txtInventarisId;
    }

    public JTextField getTxtIsbn() {
        return txtIsbn;
    }

    public void setTxtIsbn(JTextField txtIsbn) {
        this.txtIsbn = txtIsbn;
    }

    public JTextField getTxtJudul() {
        return txtJudul;
    }

    public void setTxtJudul(JTextField txtJudul) {
        this.txtJudul = txtJudul;
    }

    public JTextField getTxtNoPanggil() {
        return txtNoPanggil;
    }

    public void setTxtNoPanggil(JTextField txtNoPanggil) {
        this.txtNoPanggil = txtNoPanggil;
    }

    public JComboBox getComboPenerbit() {
        return comboPenerbit;
    }

    public void setComboPenerbit(JComboBox comboPenerbit) {
        this.comboPenerbit = comboPenerbit;
    }

    public JTextField getTxtPengarang() {
        return txtPengarang;
    }

    public void setTxtPengarang(JTextField txtPengarang) {
        this.txtPengarang = txtPengarang;
    }

    public FrmMain getFrameMain() {
        return frameMain;
    }

    public void setFrameMain(FrmMain frameMain) {
        this.frameMain = frameMain;
    }

    public JLabel getLblJumlah() {
        return lblJumlah;
    }

    public void setLblJumlah(JLabel lblJumlah) {
        this.lblJumlah = lblJumlah;
    }

    public JRadioButton getRadioSemua() {
        return radioSemua;
    }

    public void setRadioSemua(JRadioButton radioSemua) {
        this.radioSemua = radioSemua;
    }

    public void setAction() {

        frameMain.getBtnCari().setActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                if (isSelected());
                controller.findListInventaris();
            }
        });

        frameMain.getBtnRefresh().setActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                if (isSelected()) {
                    controller.refreshListInventaris();
                }
            }
        });

        frameMain.getBtnDetail().setActionListener(new ActionListener() {
        
            public void actionPerformed(ActionEvent e) {
                if (inventarisId == "KI000000") {
                    JOptionPane.showMessageDialog(rootPane, "Anda belum memilih data");
                } else {
                    inventarisDetail = new DialogInventarisDetail(frameMain, true, controller, inventarisId);
                    inventarisDetail.setVisible(true);
                }
            }

        });

        frameMain.getBtnTambah().setActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                if (isSelected()) {
                    inventarisDetail = new DialogInventarisDetail(frameMain, true, controller);
                    inventarisDetail.setVisible(true);
                }
            }
        });

        frameMain.getBtnHapus().setActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {

                controller.saveDeleteInventaris();

            }
        });

        frameMain.getBtnViewReport().setActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                if (isSelected() && tblInventaris.getRowCount() > 0) {
                    controller.report(ReportUtility.SHOW);
                }
            }
        });


        frameMain.getBtnPrintReport().setActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                if (isSelected() && tblInventaris.getRowCount() > 0) {
                    controller.report(ReportUtility.PRINT);
                }
            }
        });
    }

    public int cekOpt() {
        int opt;
        if (radioSemua.isSelected()) {
            opt = -1;
        } else if (radioTersedia.isSelected()) {
            opt = 0;
        } else if (radioTerpinjam.isSelected()) {
            opt = 1;
        }else {
            opt = 2;
        }
        return opt;
    }
    public String cekInventaris_id() {
        String inventaris_id;
        if (txtInventarisId.getText().isEmpty()) {
            inventaris_id = "_";
        } else {
            inventaris_id = txtInventarisId.getText().toString();
        }
        return inventaris_id;
    }
    public String cekBuku_id() {
        String buku_id;
        if (txtBukuId.getText().isEmpty()) {
            buku_id = "_";
        } else {
            buku_id = txtBukuId.getText().toString();
        }
        return buku_id;
    }
    public String cekIsbn() {
        String isbn;
        if (txtIsbn.getText().isEmpty()) {
            isbn = "_";
        } else {
            isbn = txtIsbn.getText().toString();
        }
        return isbn;
    }

    public String cekNoPanggil() {
        String no_panggil;
        if (txtNoPanggil.getText().isEmpty()) {
            no_panggil = "_";
        } else {
            no_panggil = txtNoPanggil.getText().toString();
        }
        return no_panggil;
    }

    public String cekJudul() {
        String judul;
        if (txtJudul.getText().isEmpty()) {
            judul = "_";
        } else {
            judul = txtJudul.getText().toString();
        }
        return judul;
    }

    public String cekPengarang() {
        String pengarang;
        if (txtPengarang.getText().isEmpty()) {
            pengarang = "_";
        } else {
            pengarang = txtPengarang.getText().toString();
        }
        return pengarang;
    }

    public String cekPenerbit() {
        String penerbit;
        if (comboPenerbit.getSelectedItem().toString().isEmpty()) {
            penerbit = "_";
        } else {
            penerbit = comboPenerbit.getSelectedItem().toString();
        }
        return penerbit;
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        gbr = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        txtBukuId = new javax.swing.JTextField();
        txtNoPanggil = new javax.swing.JTextField();
        txtInventarisId = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        txtIsbn = new javax.swing.JTextField();
        txtJudul = new javax.swing.JTextField();
        txtPengarang = new javax.swing.JTextField();
        comboPenerbit = new javax.swing.JComboBox();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        radioSemua = new javax.swing.JRadioButton();
        radioTersedia = new javax.swing.JRadioButton();
        radioTerpinjam = new javax.swing.JRadioButton();
        radioHilang = new javax.swing.JRadioButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        tblInventaris = new javax.swing.JTable();
        lblJumlah = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();

        setClosable(true);
        setIconifiable(true);
        setMaximizable(true);
        setResizable(true);
        setTitle("Data Inventaris");

        gbr.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sistemperpustakaan/image/inventaris.png"))); // NOI18N

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Search"));

        jLabel1.setText("Buku ID");

        jLabel2.setText("No Panggil");

        jLabel3.setText("ISBN");

        jLabel6.setText("ID Inventaris");

        jLabel7.setText("Judul");

        comboPenerbit.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        jLabel4.setText("Pengarang");

        jLabel5.setText("Penerbit");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel2)
                    .addComponent(jLabel1)
                    .addComponent(jLabel6)
                    .addComponent(jLabel3))
                .addGap(10, 10, 10)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(txtIsbn)
                    .addComponent(txtNoPanggil)
                    .addComponent(txtBukuId)
                    .addComponent(txtInventarisId, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel7)
                    .addComponent(jLabel5)
                    .addComponent(jLabel4))
                .addGap(24, 24, 24)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(comboPenerbit, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(txtPengarang)
                    .addComponent(txtJudul, javax.swing.GroupLayout.PREFERRED_SIZE, 163, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtInventarisId, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel6))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel1)
                            .addComponent(txtBukuId, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel2)
                            .addComponent(txtNoPanggil, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel3)
                            .addComponent(txtIsbn, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(txtJudul, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(txtPengarang, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel4)))
                            .addComponent(jLabel7))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(comboPenerbit, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel5))))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Option"));

        buttonGroup1.add(radioSemua);
        radioSemua.setText("Semua");
        radioSemua.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                radioSemuaActionPerformed(evt);
            }
        });

        buttonGroup1.add(radioTersedia);
        radioTersedia.setText("Tersedia");

        buttonGroup1.add(radioTerpinjam);
        radioTerpinjam.setText("Terpinjam");

        buttonGroup1.add(radioHilang);
        radioHilang.setText("Hilang");

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(radioSemua)
                    .addComponent(radioTersedia))
                .addGap(35, 35, 35)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(radioHilang)
                    .addComponent(radioTerpinjam)))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(radioSemua)
                    .addComponent(radioTerpinjam))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(radioTersedia)
                    .addComponent(radioHilang))
                .addContainerGap(39, Short.MAX_VALUE))
        );

        tblInventaris.setAutoCreateRowSorter(true);
        tblInventaris.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        tblInventaris.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
        jScrollPane1.setViewportView(tblInventaris);

        lblJumlah.setFont(new java.awt.Font("Tahoma", 1, 18));
        lblJumlah.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        lblJumlah.setText("0");

        jLabel8.setText("item(s) found");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                .addComponent(lblJumlah, javax.swing.GroupLayout.DEFAULT_SIZE, 266, Short.MAX_VALUE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 27, Short.MAX_VALUE)
                                .addComponent(gbr)))
                        .addContainerGap())
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 854, Short.MAX_VALUE)
                        .addGap(10, 10, 10))))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(11, 11, 11)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(20, 20, 20)
                        .addComponent(gbr, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(1, 1, 1)
                        .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel8)
                    .addComponent(lblJumlah))
                .addGap(17, 17, 17)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 448, Short.MAX_VALUE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void radioSemuaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_radioSemuaActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_radioSemuaActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JComboBox comboPenerbit;
    private javax.swing.JLabel gbr;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JLabel lblJumlah;
    private javax.swing.JRadioButton radioHilang;
    private javax.swing.JRadioButton radioSemua;
    private javax.swing.JRadioButton radioTerpinjam;
    private javax.swing.JRadioButton radioTersedia;
    private javax.swing.JTable tblInventaris;
    private javax.swing.JTextField txtBukuId;
    private javax.swing.JTextField txtInventarisId;
    private javax.swing.JTextField txtIsbn;
    private javax.swing.JTextField txtJudul;
    private javax.swing.JTextField txtNoPanggil;
    private javax.swing.JTextField txtPengarang;
    // End of variables declaration//GEN-END:variables

    public void internalFrameOpened(InternalFrameEvent e) {
    }

    public void internalFrameClosing(InternalFrameEvent e) {
    }

    public void internalFrameClosed(InternalFrameEvent e) {
    }

    public void internalFrameIconified(InternalFrameEvent e) {
    }

    public void internalFrameDeiconified(InternalFrameEvent e) {
    }

    public void internalFrameActivated(InternalFrameEvent e) {
        setAction();
    }

    public void internalFrameDeactivated(InternalFrameEvent e) {
    }

    public void valueChanged(ListSelectionEvent e) {
       try {
            inventarisId = (String) tblInventaris.getValueAt(tblInventaris.getSelectedRow(), 0);
        } catch (Exception ex) {
        }
    }
}
